<?php defined('SYSPATH') or die('No direct script access.');
 
class Model_Says extends ORM {
	protected $_table_name = 'says';

	public function getAll($postfix, $work_id) {
		return DB::select(
				array('says.content'.$postfix, 'content'), 
				array('says.say'.$postfix, 'say'), 
				'says.image',
				array('team.fio'.$postfix, 'fio'),
				array('team.post'.$postfix, 'post'),
				array('team.image', 'photo')
			)
			->from($this->_table_name)
			->join('team', 'LEFT')
			->on('says.admin_id', '=', 'team.id')
			->where('work_id', '=', $work_id)
			->order_by('says.sort', 'DESC')
			->as_object()
			->execute();
	}

}